Fixed PyCharm errors and warnings