Fixed both bugs