fixed bugs from merge