prisoner has right to apply for bail