some changes added to try solving bugs