fixed possible bugs