Fix several bugs!