main function fixes