Fixed previous bugs