Added bug fixes